package logic

import (
	"context"
	"srv/model/redis"

	"srv/cart"
	"srv/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type List1CartLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewList1CartLogic(ctx context.Context, svcCtx *svc.ServiceContext) *List1CartLogic {
	return &List1CartLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *List1CartLogic) List1Cart(in *cart.List1CartRequest) (*cart.ListCartResponse, error) {
	// todo: add your logic here and delete this line
	list1Cart, err := redis.List1Cart(in.UserId, in.GoodId)
	if err != nil {
		return nil, err
	}
	return &cart.ListCartResponse{List: list1Cart}, nil
}
